﻿using System;
using System.Windows.Forms;

namespace ComicSharp
{
    public partial class frmSettings : Form
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="frmSettings"/> class.
        /// </summary>
        public frmSettings()
        {
            InitializeComponent();
        }

        #endregion

        #region Events

        private void frmSettings_Load(object sender, EventArgs e)
        {
            // Set the radio button based on the value
            if (ComicSharp.Default.IsPortraitMode)
            {
                rbPortrait.Checked = true;
            }
            else
            {
                rbLandscape.Checked = true;
            }
        }

        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            ComicSharp.Default.IsPortraitMode = rbPortrait.Checked;
            ComicSharp.Default.Save();
        }

        /// <summary>
        /// Handles the Click event of the btnClose control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnClose_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        #endregion
    }
}
